<?php require_once('../conn/DBconnect.php'); 

	$errMsg = "";
	$method = "";
	$cmsRef = "";
	$eventId = "";
	$cmsValue = "";
	$displayType = 'short';
	
	if (isset($_POST["method"])) {
	    $method = $_POST["method"];
	}
	else 
		$errMsg = "method not specified.";
	
	if (isset($_POST["cmsRef"])) {
	    $cmsRef = $_POST["cmsRef"];
	}
	else 
		$errMsg = $errMsg."cmsRef Id not specified.";
		
	if (isset($_POST["eventId"])) {
	    $eventId = $_POST["eventId"];
	}
	else 
		$errMsg = $errMsg."eventId not specified.";
	
	if (isset($_POST["cmsValue"])) {
	    $cmsValue = $_POST["cmsValue"];
	}
	else 
		$errMsg = $errMsg."cmsTypeId not specified.";
	
	if (isset($_POST["displayType"])) {
	    $displayType = $_POST["displayType"];
	}

	if($errMsg != "")
	{
		echo $errMsg;
		return;
	}
	
	$cmsSQL = "call sp_cmscontent('".$method."','".$cmsRef."','".$cmsValue."','".$eventId."');";
	
	if ($result = mysqli_query($mysqlLink, $cmsSQL)) {
	    $cmsData = mysqli_fetch_array($result);
	
		if($displayType == "short")
			echo $cmsData["cms_short_content"];
		else
			echo $cmsData["cms_full_content"];
		
		
	    $result->close();
	}
	
	mysqli_close($mysqlLink);
?>